package main.Link;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

    public class CellRendererColorFactor extends DefaultTableCellRenderer {

    private String rrow;

    public CellRendererColorFactor(String rrow) {
        this.rrow = rrow;
    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

        if (table.getValueAt(row, 0).equals(rrow)) {
            super.setBackground(isSelected ? Color.LIGHT_GRAY : new Color(227, 227, 227));
        } else {
            super.setBackground(isSelected ? Color.LIGHT_GRAY : new Color(227, 227, 227));
        }
        super.setForeground(isSelected ? Color.black : Color.black);
        if (value == null) {
            super.setText("");
        } else {
            super.setText(value.toString());
        }
        super.setFont(new Font("Calibri", 0, 12));
        if (column == 8) {
            super.setFont(new Font("Calibri", 1, 12));
        }

        return this;
    }
}
